package com.example.yuan0605.test;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import java.util.ArrayList;
import java.util.List;

public class SQLOpenHelperActivity {
    public static List<User> beifen(SQLiteDatabase db){
        List<User> list=new ArrayList<>();
        Cursor cursor = db.query("user", null, null, null, null, null, null);
        while (cursor.moveToNext()){
            User user=new User();
            user.setUserId(cursor.getInt(cursor.getColumnIndex("userId")));
            user.setUsername(cursor.getString(cursor.getColumnIndex("username")));
            user.setPassword(cursor.getString(cursor.getColumnIndex("password")));
            list.add(user);
        }
        cursor.close();
        return list;
    }
}
